// PTZButtons.cpp : implementation file
//

#include "stdafx.h"
#include "DesktopClient.h"
#include "PTZButtons.h"


// CPTZButtons

IMPLEMENT_DYNAMIC(CPTZButtons, CWnd)

CPTZButtons::CPTZButtons()
{

}

CPTZButtons::~CPTZButtons()
{
	if (btnPtzUp)
	{
		if (IsWindow(btnPtzUp->m_hWnd))
			btnPtzUp->DestroyWindow();
		delete btnPtzUp;
	}

	if (btnPtzDown)
	{
		if (IsWindow(btnPtzDown->m_hWnd))
			btnPtzDown->DestroyWindow();
		delete btnPtzDown;
	}
	if (btnPtzLeft)
	{
		if (IsWindow(btnPtzLeft->m_hWnd))
			btnPtzLeft->DestroyWindow();
		delete btnPtzLeft;
	}
	if (btnPtzRight)
	{
		if (IsWindow(btnPtzRight->m_hWnd))
			btnPtzRight->DestroyWindow();
		delete btnPtzRight;
	}
	if (btnUpLeft)
	{
		if (IsWindow(btnUpLeft->m_hWnd))
			btnUpLeft->DestroyWindow();
		delete btnUpLeft;
	}
	if (btnUpRight)
	{
		if (IsWindow(btnUpRight->m_hWnd))
			btnUpRight->DestroyWindow();
		delete btnUpRight;
	}
	if (btnDownLeft)
	{
		if (IsWindow(btnDownLeft->m_hWnd))
			btnDownLeft->DestroyWindow();
		delete btnDownLeft;
	}
	if (btnDownRight)
	{
		if (IsWindow(btnDownRight->m_hWnd))
			btnDownRight->DestroyWindow();
		delete btnDownRight;
	}
}

void CPTZButtons::DrawControls()
{
	// Direction up
	btnPtzUp = new CClientButton();
	if (!btnPtzUp->Create(_T("up"), WS_VISIBLE|WS_CHILD, CRect(20, 0, 20, 20), this, NULL))
	{
		delete btnPtzUp;
		btnPtzUp = NULL;
	}

	// Direction down
	btnPtzDown = new CClientButton();
	if (!btnPtzDown->Create(_T("up"), WS_VISIBLE|WS_CHILD, CRect(20, 40, 20, 20), this, NULL))
	{
		delete btnPtzDown;
		btnPtzDown = NULL;
	}

	// Direction left
	btnPtzLeft = new CClientButton();
	if (!btnPtzLeft->Create(_T("up"), WS_VISIBLE|WS_CHILD, CRect(0, 20, 20, 20), this, NULL))
	{
		delete btnPtzLeft;
		btnPtzLeft = NULL;
	}

	// Direction right
	btnPtzRight = new CClientButton();
	if (!btnPtzRight->Create(_T("up"), WS_VISIBLE|WS_CHILD, CRect(0, 20, 20, 20), this, NULL))
	{

	}
	btnUpLeft = new CClientButton();
	btnUpRight = new CClientButton();
	btnDownLeft = new CClientButton();
	btnDownRight = new CClientButton();
}

BEGIN_MESSAGE_MAP(CPTZButtons, CWnd)
	ON_WM_CREATE()
END_MESSAGE_MAP()



// CPTZButtons message handlers

int CPTZButtons::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	return 0;
}

BOOL CPTZButtons::PreTranslateMessage(MSG* pMsg)
{
	

	return CWnd::PreTranslateMessage(pMsg);
}
